<?PHP

namespace SDF\Lib\Account;

use SDF\Db\MongoDb;

/**
 * 特殊权限管理类
 * @package SDF\Lib\Account
 */
class auth_special extends MongoDb {
    /**
     * 授权构造
     * special_auth constructor.
     */
    public function __construct(){
        parent::__construct('auth_special', 'account');
    }

    /**
     * 根据host获取特殊权限列表
     * @param $host
     * @param int $status
     * @return array
     * @throws \Exception
     */
    public function listByHost($host,$status = 1){
        if (empty($host)){
            throw new \Exception('$host is empty');
        }
        $where = array(
            'host'=>$host,
            'status' =>$status,
        );
        $ls = $this->find($where);
        return $ls->toArray();
    }
}